<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户信息</title>
</head>
<link href="${pageContext.request.contextPath}/css/css.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/css/style2.css" rel="stylesheet" type="text/css" />
</head>
<script>

//获取当前第几页数据
var currentPage =${page.pageNow};
//获取总页数
var totalPage =${page.totalPageCount}; 
//第一页
function firstPage(){
	if(currentPage == 1){
		alert("已经是第一页数据");
		return false;
	}else{
		window.location.href="${pageContext.request.contextPath }/admin/showOrder?id=${id}&realname=${realname}&state=${state}&pageNow=1";
		return true;
	}
}
//下一页
function nextPage(){
	if(currentPage == totalPage){
		alert("已经是最后一页数据");
		return false;
	}else{
		window.location.href="${pageContext.request.contextPath }/admin/showOrder?id=${id}&realname=${realname}&state=${state}&pageNow=" + (currentPage+1);
		return true;
	}
}
//上一页
function previousPage(){
	if(currentPage == 1){
		alert("已经是第一页数据");
		return false;
	}else{
		window.location.href="${pageContext.request.contextPath }/admin/showOrder?id=${id}&realname=${realname}&state=${state}&pageNow=" + (currentPage-1);
		return true;
	}
}
//尾页
function lastPage(){
	if(currentPage == totalPage){
		alert("已经是最后一页数据");
		return false;
	}else{
		
		window.location.href="${pageContext.request.contextPath }/admin/showOrder?id=${id}&realname=${realname}&state=${state}&pageNow=" + (totalPage);
		return true;
	}
}


</script>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
     <tr>
          <td height="62" background="${pageContext.request.contextPath}/images/nav04.png">
		   <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
		    <tr>
			  <td width="21"><img src="${pageContext.request.contextPath}/images/ico07.gif" width="20" height="18" />
			  </td>
			  <td width="580">
		   <form action="${pageContext.request.contextPath}/admin/showOrder" name="form1" method="post">    
			   订单编号：<input  name="id" type="text" size="12" value="${id}"
			    onkeyup="this.value=this.value.replace(/\D/g,'')" 
			    onpaste="false" maxlength="10"/>
			   用户姓名：<input  name="realname" type="text" size="12" value="${realname}"/>
                                       订单状态： <select  name="state"  >   
                    <option value="" >-所有订单-</option>   
                    <option value="1" <c:if test="${'1' eq state}">selected</c:if> >已完成订单</option>
                    <option value="0" <c:if test="${'0' eq state}">selected</c:if> >未完成订单</option>
                    </select>   
			    <input  type="submit" class="right-button02" value="查 询" />
			   </td>
			   </td>
			 </form>     
		    </tr>
          </table>
         </td>
   </tr>
  <tr>
    <td><table id="subtree1" style="DISPLAY: " width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td height="40" class="font42"><table id="all" width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#464646" class="newfont03">

					                  <tr>
                    <td height="20" colspan="15" align="center" bgcolor="#EEEEEE" class="tablestyle_title">
                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;订单详细列表</td>
                    </tr>
                  <tr>
					<td width="5%" height="42" align="center" bgcolor="#EEEEEE">序号</td>
					<td width="5%" align="center"  bgcolor="#EEEEEE">订单编号</td>
                    <td width="9%" align="center"  bgcolor="#EEEEEE">用户账号</td>
                    <td width="9%" align="center"  bgcolor="#EEEEEE">用户姓名</td>
					<td width="9%" align="center"  bgcolor="#EEEEEE">商品名</td>
					<td width="9%" align="center"  bgcolor="#EEEEEE">商家编号</td>
					<td width="5%" align="center"  bgcolor="#EEEEEE">商品单价</td>
					<td width="5%" align="center"  bgcolor="#EEEEEE">商品数量</td>
                    <td width="5%" align="center"  bgcolor="#EEEEEE">订单总价</td>
                    <td width="5%" align="center"  bgcolor="#EEEEEE">收货地址</td>
                    <td width="10%"align="center"  bgcolor="#EEEEEE">联系电话</td>
                    <td width="5%" align="center"  bgcolor="#EEEEEE">收货人姓名</td>
                    <td width="10%"align="center"  bgcolor="#EEEEEE">下单时间</td>
                    <td width="9%" align="center"  bgcolor="#EEEEEE">订单状态</td>
                  </tr>
                  <!-- 全部查询 -->
                    <c:forEach items="${orderList}" var="xx" varStatus="my">
					 <tr>
					<td width="5%" height="42" align="center" bgcolor="#FFFFFF">${(my.index+1)+page.pageSize*(page.pageNow-1)}</td>
					<td width="5%" align="center"  bgcolor="#FFFFFF">${xx.id}</td>
                    <td width="9%" align="center"  bgcolor="#FFFFFF">${xx.userAccount}</td>
                    <td width="9%" align="center"  bgcolor="#FFFFFF">${xx.realname}</td>
					<td width="9%" align="center"  bgcolor="#FFFFFF">${xx.goodsName}</td>
					<td width="9%" align="center"  bgcolor="#FFFFFF">${xx.saleAccount}</td>
					<td width="5%" align="center"  bgcolor="#FFFFFF">${xx.singlePrice}</td>
					<td width="5%" align="center"  bgcolor="#FFFFFF">${xx.num}</td>
                    <td width="5%" align="center"  bgcolor="#FFFFFF">${xx.sumPrice}</td>
                    <td width="5%" align="center"  bgcolor="#FFFFFF">${xx.recAddress}</td>
                    <td width="10%" align="center"  bgcolor="#FFFFFF">${xx.recPhone}</td>
                    <td width="5%" align="center"  bgcolor="#FFFFFF">${xx.recName}</td>
                    <td width="10%" align="center"  bgcolor="#FFFFFF">
                    <fmt:formatDate value="${xx.orderTime}" pattern="yyyy-MM-dd HH:mm:ss"
					type="both" /></td>
                    <td width="9%" align="center"  bgcolor="#FFFFFF">
                       <c:if test="${xx.state==0}">
                                                                    未完成订单 
                       </c:if>
                       <c:if test="${xx.state==1}">
                                                                   已完成订单
                       </c:if>
                    </td>
                  </tr>
				  </c:forEach>
                </table></td>
              </tr>
            </table></td>
        </tr>
      </table>
      <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="6"><img src="${pageContext.request.contextPath}/images/spacer.png" width="1" height="1" /></td>
        </tr>
        <tr>
          <td height="33"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="right-font08">
              <tr>
                <td width="50%">共 <span class="right-text09">${page.totalPageCount}</span> 页 | 第 <span class="right-text09">${page.pageNow}</span> 页</td>
                <td width="45%" align="right">
                [ <a href="#" class="right-font08" onclick="firstPage();">首页</a>
                | <a href="#" class="right-font08" onclick="previousPage();">上一页</a>
                | <a href="#" class="right-font08" onclick="nextPage();">下一页</a> 
                | <a href="#" class="right-font08" onclick="lastPage();">末页</a>
                ]</td>
                <td width="5%">
                
                </td>
              </tr>
          </table>
          </td>
        </tr>
      </table>
      </td>
  </tr>
<table>
</body>
</html>
        
     